﻿using FolderTag.DB.Dbo;
using System;
using System.Windows.Media;

namespace FolderTag.Model
{
    public class TagItem
    {
        public TagItem()
        {
            Color = Color.FromArgb(255, 128, 128, 128);
        }

        public TagItem(FolderTagDbo dbo)
        {
            Id = dbo.Id.Value;
            Name = dbo.Name;
            var temp = dbo.Color.Split(',');
            Color = Color.FromArgb(Byte.Parse(temp[0]), Byte.Parse(temp[1]), Byte.Parse(temp[2]), Byte.Parse(temp[3]));
        }
        /// <summary>
        /// 编号
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 标签名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 标签名称
        /// </summary>
        public Color Color { get; set; }

        internal static TagItem Clone(TagItem tag)
        {
            return new TagItem()
            {
                Color = tag.Color,
                Id = tag.Id,
                Name = tag.Name,
            };
        }
    }
}
